import BNodeDecorator from "../base/BNodeDecorator";
import {ActionResult} from "../BTreeActionResult";
const {ccclass, property} = cc._decorator;
//<Tree-Category>{"path":"decorators","color":"#fff419","tip":""}</Tree-Category>
@ccclass
/**
 * 结果翻转
 */
export default class BNodeReturnSuccess extends BNodeDecorator {
    public onEcute(): ActionResult {
        if (!this.child) {
            return ActionResult.ERROR;
        }
        let status: ActionResult = this.child.runNode();
        if(status == ActionResult.FAILURE){
            return ActionResult.SUCCESS;
        }
        return status;
    }
}
